<template>
  <tbody>
    <tr v-for="(item, index) in goodList" :key="index">
      <td>
        <input type="checkbox" v-model="item.checked" />
      </td>
      <td>{{ item.name }}</td>
      <td>{{ item.price }}</td>
      <td>
        <button @click="reduce(index)">-</button>
        {{ item.num }}
        <button @click="add(index)">+</button>
      </td>
      <td>{{ item.price * item.num }}</td>
      <td><button @click="del(index)">删除</button></td>
    </tr>
  </tbody>
</template>

<script>
export default {
  props: ['goodList'],
  // 数量加减
  methods: {
    reduce(i) {
      this.$emit('reduce', i)
    },
    add(i) {
      this.$emit('add', i)
    },
    // 删除
    del(i) {
      this.$emit('del', i)
    },
    // 多选框
    // Cheange(numx) {
    //   this.$emit('Cheange', numx)
    // },
  },
}
</script>

<style></style>
